<template>
	<nav-header :title="titleObj[code] || '文章详情'">
		<view class="p-4">
			<view class="text-black-33 font-bold text-lg" v-text="contentObj.title"></view>
			<view class="my-2 text-gray-99" v-text="$util.getFormatDate(contentObj.publishTime)"></view>
			<view v-if="contentObj.summary" class="text-gray-99 text-sm mb-4" v-text="'概述：' + contentObj.summary"></view>
			<u-parse :content="contentObj.content"></u-parse>
		</view>
    <view class="bg-white mb-4 p-4 pb-6" v-if="contentObj.isConsult === '1'">
      <view class="bg-white w-full py-4 fixed bottom-0 z-50 shadow-lg">
        <view class="flex items-center mx-5">
          <view class="text-center mr-8">
            <i class="iconfont icon-fenxiang block text-xl text-color-a0"></i>
            <text class="text-gray-99 text-sm">分享</text>
          </view>
          <view  class="flex items-center justify-center flex-1 py-2_5 rounded-full text-white mx-1 bg-theme  "
                 @click="$util.myNavigateTo('/pages_mine/edit_user?businessType='+code+'&businessId='+contentObj.id+'&businessName='+contentObj.name)">需求对接</view>
        </view>
      </view>
    </view>
	</nav-header>
</template>

<script>
	import * as articleApi from '@/interface/junchuang/article.js'
	import NavHeader from '@/components/nav_header.vue'
	export default {
		components: {
			NavHeader
		},
		data() {
			const v = this
			return {
				id: '',
				code: '',
				contentObj: {
					title: '',
					content: '',
					publishTime: '',
          isConsult: '0',
          consultPhone: '',
					summary: ''
				},
				titleObj: {
					park_dynamics_news: '园区动态',
          find_policy: '找政策',
          find_policy_talent: '人才政策',
          find_policy_industry: '产业政策',
					policy_support: '政策支持',
					charity_report: '公益报告',
					company_regist: '企业注册',
          demand_release: '需求详情',
					business_services: '工商服务',
					intellectual_property_right: '知识产权',
					about_us: v.$config.sub_app_name,
					rospective_analysis: '前景分析',
					team_service: '团队服务',
					common_problem: '常见问题',

					military_style: '园区风采',
          home_banner: '热门资讯',
				}
			}
		},
		onLoad(e) {
			if (e.id) this.id = e.id
			if (e.code) this.code = e.code
		},
		onShow() {
      this.$util.openShare();
			const v = this
			articleApi.getArticleDetail({
				articleId: v.id,
				columnCode: v.code
			}).then(res=>{
				if (res.success) {
          console.log("文章数据",res.data)
					Object.assign(v.contentObj, res.data)
				}
			})
		},
		methods: {
      phoneCall () {
        const v = this
        if (!v.contentObj.phone) return
        if (v.platform == 'ios') {
          call()
        }else {
          wx.showActionSheet({
            itemList: [v.contentObj.phone,'呼叫'],
            success:function(res){
              if(res.tapIndex==1){
                call()
              }
            }
          })
        }
        function call() {
          wx.makePhoneCall({
            phoneNumber: v.contentObj.phone
          })
        }
      },
		}
	}
</script>

<style>

</style>
